import {Http} from '@angular/http';
import {NgLayer, NgLayerRef} from 'ng2-layer';
import {Component,ViewContainerRef, Injectable}  from '@angular/core';
/**
 * 左侧菜单部分
 */
@Component({
	selector: '.category',
	templateUrl: 'template/router/user.html'
})
export class UserComp {
	status:any = ['', '待发货','已发货','确认收货','交易完成','已取消'];
	isPay:any = ['线下','线上'];
	detailId = -1;
	
	constructor(private http:Http, private layer:NgLayer){
		this.http.get({
			search:{
				m:"Admin",
				c:"ApiSchool",
				a:"getSchoolUserList"
			}
		}).then((d)=>{
			this.users = d.data;
		});
	}
	
	showUserOrder(u){
		this.orderUser = u;
		
		/**
		 * 获取用户订单
		 */
		this.http.get({
			search:{
				m:"Admin",
				c:"ApiSchool",
				a:"getUserOrderInfo",
				user_id:u.user_id
			}
		}).then((d)=>{
			this.orders = d.data;
		});
	}
	
	backToUsers(){
		this.orderUser=null;
		this.orders = null
	}
}